package com.lsy.poi.row.indexer;

import org.apache.poi.xssf.usermodel.XSSFRow;

import com.lsy.poi.bean.Index;


public class FixedRangeRowIndexer extends RowIndexer {
	
	private int beginIndex;
	private int endIndex;
	

	public FixedRangeRowIndexer(int beginIndex, int endIndex) {
		super();
		this.index = new Index(beginIndex);
		this.beginIndex = beginIndex;
		this.endIndex = endIndex;
	}

	@Override
	public boolean triggerBeginning(XSSFRow row) {
		
//		return triggerBeginning();
		
		/*
		if(getIndex() <= beginIndex) {
			return false;
		} else {
			return true; 
		}
		*/
		int qwe = getIndex();
		if(getIndex() == beginIndex) {//开头啦~~~，将这个 row 加入 list
			return true;
		} else {
			return false; 
		}
		
		/*
		if((row !=null) && (row.getRowNum()==beginIndex)) {
			return true;
		} else {
			return false; 
		}
		*/
		
	}

	@Override
	public boolean triggerEnding(XSSFRow row) {
		
//		return triggerBeginning();
		
		
		int qwe = getIndex();
		if(getIndex() > endIndex) {//结尾啦~~~~：这个单元格 不满足 条件，不把他 放入 list，并 终结 整个 list 的  收集动作
			return true;
		} else {
			return false; 
		}
		
		/*
		if((row !=null) && (row.getRowNum()<=endIndex)) {
			return false;
		} else {
			return true; 
		}
		*/
	}

}
